/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * ConsultaCandidat.java
 *
 * Created on 27/03/2011, 02:06:30 AM
 */

package zonasoft.Vistas.Funcionales;

import com.mysql.jdbc.Connection;
import java.awt.Color;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.HashMap;
import java.util.Map;
import javax.swing.JOptionPane;
import zonasoft.Conceptos.Lider;
import zonasoft.Conceptos.Usuario;
import zonasoft.Conceptos.Zonificados;
import zonasoft.Manejadores.ManejadorBaseDatos;
import zonasoft.Manejadores.ManejadorLider;
import zonasoft.Manejadores.ManejadorPuesto;
import zonasoft.Manejadores.ManejadorUsuario;
import zonasoft.Manejadores.ManejadorZonificados;
import zonasoft.Vistas.inicioSesion;

/**
 *
 * @author Usuario
 */
public class EliminarZonificado extends javax.swing.JFrame {

    /** Creates new form ConsultaCandidat */
    public EliminarZonificado() {
        initComponents();
        this.setLocationRelativeTo(null);
    }
HashMap<String,Integer> elecciones;
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jXTaskPaneContainer1 = new org.jdesktop.swingx.JXTaskPaneContainer();
        jLabel1 = new javax.swing.JLabel();
        jXPanel2 = new org.jdesktop.swingx.JXPanel();
        BotonConsultar = new javax.swing.JButton();
        BotonLimpiar = new javax.swing.JButton();
        eliminar = new javax.swing.JButton();
        BotonAceptar = new javax.swing.JButton();
        jXPanel5 = new org.jdesktop.swingx.JXPanel();
        jXPanel1 = new org.jdesktop.swingx.JXPanel();
        campoNombre = new javax.swing.JTextField();
        campoProfesion = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        campoApellido = new javax.swing.JTextField();
        campotelefono = new javax.swing.JTextField();
        jLabel24 = new javax.swing.JLabel();
        campoCorreo = new javax.swing.JTextField();
        jLabel21 = new javax.swing.JLabel();
        campoRef = new javax.swing.JTextField();
        jLabel20 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        campoDireccion = new javax.swing.JTextArea();
        jLabel25 = new javax.swing.JLabel();
        campoBarrio = new javax.swing.JTextField();
        jXPanel4 = new org.jdesktop.swingx.JXPanel();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        nombreLider = new javax.swing.JTextField();
        idLider = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        puesto = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        mesa = new javax.swing.JTextField();
        jLabel16 = new javax.swing.JLabel();
        jScrollPane3 = new javax.swing.JScrollPane();
        direccionPuesto = new javax.swing.JTextArea();
        jLabel2 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        fecg = new org.jdesktop.swingx.JXDatePicker();
        labelUsuario = new javax.swing.JLabel();
        campoIdentificacion = new javax.swing.JTextField();
        jLabel13 = new javax.swing.JLabel();
        jXPanel6 = new org.jdesktop.swingx.JXPanel();
        jLabel26 = new javax.swing.JLabel();
        campoBarrio1 = new javax.swing.JTextField();
        jLabel27 = new javax.swing.JLabel();
        campoBarrio2 = new javax.swing.JTextField();
        franja = new javax.swing.JTextField();
        ucg = new javax.swing.JLabel();
        ucg1 = new javax.swing.JLabel();
        jXTaskPaneContainer2 = new org.jdesktop.swingx.JXTaskPaneContainer();
        jLabel28 = new javax.swing.JLabel();

        setResizable(false);

        jLabel1.setFont(new java.awt.Font("Lucida Bright", 1, 18));
        jLabel1.setText("Eliminacion de Zonificados");
        jXTaskPaneContainer1.add(jLabel1);

        jXPanel2.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED, java.awt.Color.lightGray, java.awt.Color.gray, java.awt.Color.lightGray, java.awt.Color.gray));

        BotonConsultar.setFont(new java.awt.Font("Lucida Bright", 1, 12));
        BotonConsultar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/zonasoft/Vistas/iconos/search-icon2.png"))); // NOI18N
        BotonConsultar.setText("Consultar");
        BotonConsultar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotonConsultarActionPerformed(evt);
            }
        });

        BotonLimpiar.setFont(new java.awt.Font("Lucida Bright", 1, 12));
        BotonLimpiar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/zonasoft/Vistas/iconos/limpiar.png"))); // NOI18N
        BotonLimpiar.setText("Limpiar");
        BotonLimpiar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotonLimpiarActionPerformed(evt);
            }
        });

        eliminar.setFont(new java.awt.Font("Lucida Bright", 1, 12));
        eliminar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/zonasoft/Vistas/iconos/Close-icon.png"))); // NOI18N
        eliminar.setText("Eliminar");
        eliminar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eliminarActionPerformed(evt);
            }
        });

        BotonAceptar.setFont(new java.awt.Font("Lucida Bright", 1, 12));
        BotonAceptar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/zonasoft/Vistas/iconos/ok 32.png"))); // NOI18N
        BotonAceptar.setText("Aceptar");
        BotonAceptar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotonAceptarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jXPanel2Layout = new javax.swing.GroupLayout(jXPanel2);
        jXPanel2.setLayout(jXPanel2Layout);
        jXPanel2Layout.setHorizontalGroup(
            jXPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jXPanel2Layout.createSequentialGroup()
                .addGroup(jXPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jXPanel2Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(eliminar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(jXPanel2Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(BotonAceptar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jXPanel2Layout.createSequentialGroup()
                        .addGap(11, 11, 11)
                        .addGroup(jXPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(BotonConsultar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(BotonLimpiar, javax.swing.GroupLayout.DEFAULT_SIZE, 147, Short.MAX_VALUE))))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jXPanel2Layout.setVerticalGroup(
            jXPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jXPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(BotonConsultar, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(BotonLimpiar, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(eliminar, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(BotonAceptar)
                .addContainerGap())
        );

        jXPanel5.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED, java.awt.Color.lightGray, java.awt.Color.lightGray, java.awt.Color.black, java.awt.Color.black));

        jXPanel1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED, java.awt.Color.lightGray, java.awt.Color.lightGray, java.awt.Color.gray, java.awt.Color.gray));
        jXPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        campoNombre.setEditable(false);
        jXPanel1.add(campoNombre, new org.netbeans.lib.awtextra.AbsoluteConstraints(87, 13, 191, -1));

        campoProfesion.setEditable(false);
        jXPanel1.add(campoProfesion, new org.netbeans.lib.awtextra.AbsoluteConstraints(87, 82, 191, -1));

        jLabel9.setFont(new java.awt.Font("Lucida Bright", 0, 12));
        jLabel9.setText("Nombre");
        jXPanel1.add(jLabel9, new org.netbeans.lib.awtextra.AbsoluteConstraints(12, 15, -1, -1));

        jLabel10.setFont(new java.awt.Font("Lucida Bright", 0, 12));
        jLabel10.setText("Profesion");
        jXPanel1.add(jLabel10, new org.netbeans.lib.awtextra.AbsoluteConstraints(12, 84, -1, -1));

        jLabel12.setFont(new java.awt.Font("Lucida Bright", 0, 12));
        jLabel12.setText("Telefono");
        jXPanel1.add(jLabel12, new org.netbeans.lib.awtextra.AbsoluteConstraints(12, 195, -1, -1));

        jLabel11.setFont(new java.awt.Font("Lucida Bright", 0, 12));
        jLabel11.setText("Apellidos");
        jXPanel1.add(jLabel11, new org.netbeans.lib.awtextra.AbsoluteConstraints(12, 46, -1, -1));

        campoApellido.setEditable(false);
        jXPanel1.add(campoApellido, new org.netbeans.lib.awtextra.AbsoluteConstraints(87, 44, 191, -1));

        campotelefono.setEditable(false);
        jXPanel1.add(campotelefono, new org.netbeans.lib.awtextra.AbsoluteConstraints(87, 193, 191, -1));

        jLabel24.setFont(new java.awt.Font("Lucida Bright", 0, 12));
        jLabel24.setText("correo");
        jXPanel1.add(jLabel24, new org.netbeans.lib.awtextra.AbsoluteConstraints(12, 157, -1, -1));

        campoCorreo.setEditable(false);
        jXPanel1.add(campoCorreo, new org.netbeans.lib.awtextra.AbsoluteConstraints(87, 155, 191, -1));

        jLabel21.setFont(new java.awt.Font("Lucida Bright", 0, 12));
        jLabel21.setText("Hoja Ref:");
        jXPanel1.add(jLabel21, new org.netbeans.lib.awtextra.AbsoluteConstraints(12, 115, -1, -1));

        campoRef.setEditable(false);
        jXPanel1.add(campoRef, new org.netbeans.lib.awtextra.AbsoluteConstraints(87, 113, 191, -1));

        jLabel20.setFont(new java.awt.Font("Lucida Bright", 0, 12));
        jLabel20.setText("Direccion");
        jXPanel1.add(jLabel20, new org.netbeans.lib.awtextra.AbsoluteConstraints(12, 264, -1, -1));

        campoDireccion.setColumns(20);
        campoDireccion.setEditable(false);
        campoDireccion.setRows(5);
        jScrollPane1.setViewportView(campoDireccion);

        jXPanel1.add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 250, 191, 40));

        jLabel25.setFont(new java.awt.Font("Lucida Bright", 0, 12));
        jLabel25.setText("Barrio");
        jXPanel1.add(jLabel25, new org.netbeans.lib.awtextra.AbsoluteConstraints(12, 221, -1, -1));

        campoBarrio.setEditable(false);
        jXPanel1.add(campoBarrio, new org.netbeans.lib.awtextra.AbsoluteConstraints(87, 219, 191, -1));

        jXPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED, java.awt.Color.lightGray, java.awt.Color.lightGray, java.awt.Color.gray, java.awt.Color.gray), "Datos Generales", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Lucida Bright", 1, 12))); // NOI18N

        jLabel17.setFont(new java.awt.Font("Lucida Bright", 0, 12));
        jLabel17.setText("Identificacion Lider");

        jLabel18.setFont(new java.awt.Font("Lucida Bright", 0, 12));
        jLabel18.setText("Nombre Lider");

        nombreLider.setEditable(false);

        idLider.setEditable(false);

        jLabel14.setFont(new java.awt.Font("Lucida Bright", 0, 12));
        jLabel14.setText("Puesto de Votacion");

        puesto.setEditable(false);

        jLabel15.setFont(new java.awt.Font("Lucida Bright", 0, 12));
        jLabel15.setText("N° de Mesa");

        mesa.setEditable(false);

        jLabel16.setFont(new java.awt.Font("Lucida Bright", 0, 12));
        jLabel16.setText("Direccion ");

        direccionPuesto.setColumns(20);
        direccionPuesto.setEditable(false);
        direccionPuesto.setRows(5);
        jScrollPane3.setViewportView(direccionPuesto);

        jLabel2.setFont(new java.awt.Font("Lucida Bright", 0, 12));
        jLabel2.setText("Ingresado por");

        jLabel4.setFont(new java.awt.Font("Lucida Bright", 0, 12));
        jLabel4.setText("en esta fecha");

        fecg.setEditable(false);
        fecg.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                fecgActionPerformed(evt);
            }
        });

        labelUsuario.setVerticalAlignment(javax.swing.SwingConstants.TOP);

        javax.swing.GroupLayout jXPanel4Layout = new javax.swing.GroupLayout(jXPanel4);
        jXPanel4.setLayout(jXPanel4Layout);
        jXPanel4Layout.setHorizontalGroup(
            jXPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jXPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jXPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jXPanel4Layout.createSequentialGroup()
                        .addGroup(jXPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel17)
                            .addComponent(jLabel18))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jXPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(nombreLider, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(idLider, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jXPanel4Layout.createSequentialGroup()
                        .addGroup(jXPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel14)
                            .addComponent(jLabel15)
                            .addComponent(jLabel16))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jXPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 178, Short.MAX_VALUE)
                            .addGroup(jXPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(mesa, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(puesto, javax.swing.GroupLayout.DEFAULT_SIZE, 176, Short.MAX_VALUE))
                            .addComponent(fecg, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(labelUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(jLabel2)
                    .addComponent(jLabel4))
                .addContainerGap())
        );
        jXPanel4Layout.setVerticalGroup(
            jXPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jXPanel4Layout.createSequentialGroup()
                .addGroup(jXPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel17)
                    .addComponent(idLider, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jXPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel18)
                    .addComponent(nombreLider, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(30, 30, 30)
                .addGroup(jXPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel14)
                    .addComponent(puesto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jXPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel15)
                    .addComponent(mesa, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jXPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel16)
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 23, Short.MAX_VALUE)
                .addGroup(jXPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel2)
                    .addComponent(labelUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(7, 7, 7)
                .addGroup(jXPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(fecg, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        campoIdentificacion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                campoIdentificacionActionPerformed(evt);
            }
        });

        jLabel13.setFont(new java.awt.Font("Lucida Bright", 1, 12));
        jLabel13.setText("Identificacion");

        javax.swing.GroupLayout jXPanel5Layout = new javax.swing.GroupLayout(jXPanel5);
        jXPanel5.setLayout(jXPanel5Layout);
        jXPanel5Layout.setHorizontalGroup(
            jXPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jXPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jXPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jXPanel5Layout.createSequentialGroup()
                        .addComponent(jLabel13)
                        .addGap(18, 18, 18)
                        .addComponent(campoIdentificacion, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jXPanel5Layout.createSequentialGroup()
                        .addComponent(jXPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 303, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jXPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(22, 22, 22))
        );
        jXPanel5Layout.setVerticalGroup(
            jXPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jXPanel5Layout.createSequentialGroup()
                .addGap(37, 37, 37)
                .addGroup(jXPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel13)
                    .addComponent(campoIdentificacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jXPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jXPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jXPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 303, Short.MAX_VALUE))
                .addContainerGap(32, Short.MAX_VALUE))
        );

        jXPanel6.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED, java.awt.Color.lightGray, java.awt.Color.lightGray, java.awt.Color.gray, java.awt.Color.gray));

        jLabel26.setFont(new java.awt.Font("Lucida Bright", 0, 12));
        jLabel26.setText("Reside en:");

        campoBarrio1.setEditable(false);

        jLabel27.setFont(new java.awt.Font("Lucida Bright", 0, 12));
        jLabel27.setText("Vota en:");

        campoBarrio2.setEditable(false);

        franja.setEditable(false);

        ucg.setText("ucg");

        ucg1.setText("ucg");

        jLabel28.setBackground(new java.awt.Color(255, 102, 0));
        jLabel28.setFont(new java.awt.Font("Lucida Bright", 1, 12));
        jLabel28.setText("Analisis Zonificacion");
        jLabel28.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED, java.awt.Color.white, java.awt.Color.white, java.awt.Color.white, java.awt.Color.white));
        jXTaskPaneContainer2.add(jLabel28);

        javax.swing.GroupLayout jXPanel6Layout = new javax.swing.GroupLayout(jXPanel6);
        jXPanel6.setLayout(jXPanel6Layout);
        jXPanel6Layout.setHorizontalGroup(
            jXPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jXPanel6Layout.createSequentialGroup()
                .addGroup(jXPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jXPanel6Layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jXPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jXPanel6Layout.createSequentialGroup()
                                .addComponent(jLabel26)
                                .addGap(10, 10, 10)
                                .addComponent(ucg, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jXPanel6Layout.createSequentialGroup()
                                .addGroup(jXPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(campoBarrio1, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGroup(jXPanel6Layout.createSequentialGroup()
                                        .addComponent(jLabel27)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(ucg1, javax.swing.GroupLayout.PREFERRED_SIZE, 96, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addGap(147, 147, 147))))
                    .addGroup(jXPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jXPanel6Layout.createSequentialGroup()
                            .addContainerGap()
                            .addComponent(franja))
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jXPanel6Layout.createSequentialGroup()
                            .addGap(10, 10, 10)
                            .addComponent(campoBarrio2, javax.swing.GroupLayout.DEFAULT_SIZE, 114, Short.MAX_VALUE)))
                    .addComponent(jXTaskPaneContainer2, javax.swing.GroupLayout.PREFERRED_SIZE, 169, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        jXPanel6Layout.setVerticalGroup(
            jXPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jXPanel6Layout.createSequentialGroup()
                .addComponent(jXTaskPaneContainer2, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jXPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(ucg, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel26))
                .addGap(11, 11, 11)
                .addComponent(campoBarrio1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(jXPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel27)
                    .addComponent(ucg1, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(campoBarrio2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(franja, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(13, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jXPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(jXPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jXPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, 172, Short.MAX_VALUE)))
            .addComponent(jXTaskPaneContainer1, javax.swing.GroupLayout.PREFERRED_SIZE, 913, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jXTaskPaneContainer1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(31, 31, 31)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jXPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jXPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addComponent(jXPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(27, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void BotonAceptarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotonAceptarActionPerformed
        // TODO add your handling code here:
        this.dispose();
    }//GEN-LAST:event_BotonAceptarActionPerformed

    private void BotonConsultarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotonConsultarActionPerformed
        // TODO add your handling code here:
       ManejadorBaseDatos manejabd = ManejadorBaseDatos.getInstancia();
        try {
             manejabd.conectar();
             ManejadorZonificados.con = manejabd.getConexion();
             ManejadorLider.conm = manejabd.getConexion();
             ManejadorPuesto.con = (Connection) manejabd.getConexion();
             ManejadorUsuario.conm = manejabd.getConexion();
              Zonificados zonificadoActual=null;
              Map<String,String> resultados=null;
////             zo = null;
    String h = campoIdentificacion.getText();
             Zonificados zo = null;
             String idZ = campoIdentificacion.getText();
//             System.out.println("idZ = " + idZ);
             zo = ManejadorZonificados.getZonificadosPropio(idZ);
//                  System.out.print(zo + " del consultar");
           if(!campoIdentificacion.getText().isEmpty()){
             if(zo != null){
     // datos del zonificado
                  campoIdentificacion.setText(zo.getIdZonificado());
                  campoNombre.setText(zo.getNombres());
                  campoApellido.setText(zo.getApellidos());
                  campoProfesion.setText(zo.getCargo());
                  campotelefono.setText(zo.getTelefono());
                  campoCorreo.setText(zo.getCorreo());
                  campoRef.setText(zo.getCodHoja());
                  campoDireccion.setText(zo.getDireccion());
                  campoBarrio.setText(zo.getIdBarrio());
      // datos del lider
                  Lider li = null;
                  String idL = zo.getIdLider();
                  idLider.setText(idL);
                  li = ManejadorLider.getLider(idL);
                  nombreLider.setText(li.getNombre()+" "+li.getApellido());
              
               // datos
//                 Puesto pu = null;
//               String idP = zo.getIdPuesto();
//                  pu = ManejadorPuesto.getPuesto(idP);
//                 
//                  direccionPuesto.setText(pu.getDireccion());
                 resultados=ManejadorZonificados.getDatosVotacion(zo.getIdPuesto());
                  puesto.setText(resultados.get("puesto"));
                  mesa.setText(zo.getNumeroMesa());
                  direccionPuesto.setText(resultados.get("barrio"));
  // Parte de la franja
         campoBarrio1.setText(zo.getIdBarrio());
         campoBarrio2.setText(resultados.get("barrio"));
         boolean answer=false;
         int terceraRespuesta=-1;
         Map<String,Integer> unidadesByBarrio=null;
         Object[] resultado=ManejadorZonificados.validarZonificacion(zo.getIdBarrio(), resultados.get("barrio"));
         unidadesByBarrio=(Map<String, Integer>) resultado[0];
         answer=(Boolean)resultado[1];
         terceraRespuesta=(Integer)resultado[2];
         if(answer==true)
         franja.setBackground(Color.GREEN);
         else
         franja.setBackground(Color.red);                
         if(terceraRespuesta==0)
         {
         ucg.setText("UCG #"+String.valueOf(unidadesByBarrio.get(zo.getIdBarrio().toLowerCase())));
         ucg1.setText("UCG #"+String.valueOf(unidadesByBarrio.get(resultados.get("barrio").toLowerCase())));
         }
         else
         {
          ucg.setText(String.valueOf(terceraRespuesta));
          ucg1.setText(String.valueOf(terceraRespuesta));
         }               
                  Usuario us = null;
                 us = inicioSesion.userActual;
                  labelUsuario.setText(us.getLogin_usuario());                 
                  java.util.Date fechaC = new java.util.Date(zo.getFechadeCreacion().getTime());
                  fecg.setDate(fechaC);                                                   
             }else{
         JOptionPane.showMessageDialog(null," No se ha zonificado a esta persona", "Busqueda sin resultados",JOptionPane.INFORMATION_MESSAGE);
                    }
           }else{
           JOptionPane.showMessageDialog(null, "Por favor digite la identificacion","Campo Vacio",JOptionPane.WARNING_MESSAGE);
           }
          } catch (Exception ex) {
            Logger.getLogger(EliminarZonificado.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_BotonConsultarActionPerformed

    private void BotonLimpiarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotonLimpiarActionPerformed
        // TODO add your handling code here:
        limpiar();
    }//GEN-LAST:event_BotonLimpiarActionPerformed

    private void campoIdentificacionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_campoIdentificacionActionPerformed
        // TODO add your handling code here:
       BotonConsultarActionPerformed(evt);
    }//GEN-LAST:event_campoIdentificacionActionPerformed

    private void fecgActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fecgActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_fecgActionPerformed

    private void eliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_eliminarActionPerformed
        // TODO add your handling code here:
        if(!campoIdentificacion.getText().isEmpty()){
        int res = JOptionPane.showConfirmDialog(this,"En realidad desea eliminar este zonificado"," warning", JOptionPane.YES_NO_OPTION)   ;
        if (res == JOptionPane.YES_OPTION){
            ManejadorBaseDatos manejabd = ManejadorBaseDatos.getInstancia();
            try {
                manejabd.conectar();
                ManejadorZonificados.conm=manejabd.getConexion();
                String id = campoIdentificacion.getText();
                ManejadorZonificados.deleteZonificado(id);
                limpiar();
                JOptionPane.showMessageDialog(null," Este Zonificado ha sido eliminado", "Eliminacion Exitosa",JOptionPane.INFORMATION_MESSAGE);
            } catch (Exception ex) {
                Logger.getLogger(EliminarZonificado.class.getName()).log(Level.SEVERE, null, ex);
              }
        }
       }else{
           JOptionPane.showMessageDialog(null,"Campo Identificacion es Obligatorio","Error",JOptionPane.ERROR_MESSAGE);
       }
}//GEN-LAST:event_eliminarActionPerformed

    public void limpiar(){
      campoIdentificacion.setText("");
             campoNombre.setText("");
            campoApellido.setText("");
            campoProfesion.setText("");
            campotelefono.setText("");
            campoCorreo.setText("");
            campoRef.setText("");
            campoDireccion.setText("");
            campoBarrio.setText("");
            
            labelUsuario.setText("");
            fecg.setDate(null);
            idLider.setText("");
            nombreLider.setText("");
 franja.setBackground(null);
          
            ucg.setText("");
            ucg1.setText("");
            campoBarrio1.setText("");
            campoBarrio2.setText("");
            
            puesto.setText("");
            mesa.setText("");
            direccionPuesto.setText("");

    }


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton BotonAceptar;
    private javax.swing.JButton BotonConsultar;
    private javax.swing.JButton BotonLimpiar;
    private javax.swing.JTextField campoApellido;
    private javax.swing.JTextField campoBarrio;
    private javax.swing.JTextField campoBarrio1;
    private javax.swing.JTextField campoBarrio2;
    private javax.swing.JTextField campoCorreo;
    private javax.swing.JTextArea campoDireccion;
    private javax.swing.JTextField campoIdentificacion;
    private javax.swing.JTextField campoNombre;
    private javax.swing.JTextField campoProfesion;
    private javax.swing.JTextField campoRef;
    private javax.swing.JTextField campotelefono;
    private javax.swing.JTextArea direccionPuesto;
    private javax.swing.JButton eliminar;
    private org.jdesktop.swingx.JXDatePicker fecg;
    private javax.swing.JTextField franja;
    private javax.swing.JTextField idLider;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane3;
    private org.jdesktop.swingx.JXPanel jXPanel1;
    private org.jdesktop.swingx.JXPanel jXPanel2;
    private org.jdesktop.swingx.JXPanel jXPanel4;
    private org.jdesktop.swingx.JXPanel jXPanel5;
    private org.jdesktop.swingx.JXPanel jXPanel6;
    private org.jdesktop.swingx.JXTaskPaneContainer jXTaskPaneContainer1;
    private org.jdesktop.swingx.JXTaskPaneContainer jXTaskPaneContainer2;
    private javax.swing.JLabel labelUsuario;
    private javax.swing.JTextField mesa;
    private javax.swing.JTextField nombreLider;
    private javax.swing.JTextField puesto;
    private javax.swing.JLabel ucg;
    private javax.swing.JLabel ucg1;
    // End of variables declaration//GEN-END:variables

}
